package com.openbravo.pos.printer.escpos;

import javax.swing.JComponent;

import net.xeoh.plugins.base.annotations.PluginImplementation;

import com.openbravo.pos.config.ParametersConfig;
import com.openbravo.pos.printer.DevicePrinter;
import com.openbravo.pos.printer.PrinterWritterPool;
import com.openbravo.pos.printer.TicketPrinterException;
import com.openbravo.pos.printer.config.ParametersComm;

@PluginImplementation
public class DevicePrinterTMU220 extends AbstractDevicePrinterESCPOS {

	@Override
	public String getPrinterType() {
		
		return "tmu220";
	}

	
	
	public DevicePrinterTMU220() {
		
	}



	public DevicePrinterTMU220(String sPrinterParam1, String sPrinterParam2)
			throws TicketPrinterException {
		//m_sName = AppLocal.getIntString("Printer.Serial");
        m_CommOutputPrinter = PrinterWritterPool.INSTANCE.getPrinterWritter(sPrinterParam1, sPrinterParam2);
        m_codes = new CodesTMU220();
        m_trans = new UnicodeTranslatorInt();

        // Inicializamos la impresora
        m_CommOutputPrinter.init(ESCPOS.INIT);

        m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER); // A la impresora
        m_CommOutputPrinter.init(m_codes.getInitSequence());
        m_CommOutputPrinter.write(m_trans.getCodeTable());

        m_CommOutputPrinter.flush();  
		
	}

	@Override
	public JComponent getPrinterComponent() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public DevicePrinter init(String sPrinterParam1, String sPrinterParam2)
			throws TicketPrinterException {
		return new DevicePrinterTMU220(sPrinterParam1, sPrinterParam2);
	}

	@Override
	public ParametersConfig getConfiguration() {
		return new ParametersComm();
	}

}
